/**
 * <copyright>
 * </copyright>
 *
 */
package org.xtext.example.mydsl.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.myDsl.IP;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Puerto;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>IP</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPImpl#getPrimer <em>Primer</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPImpl#getSegundo <em>Segundo</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPImpl#getTercer <em>Tercer</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPImpl#getCuarto <em>Cuarto</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPImpl#getPuerto <em>Puerto</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IPImpl extends DestinoImpl implements IP
{
  /**
   * The default value of the '{@link #getPrimer() <em>Primer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPrimer()
   * @generated
   * @ordered
   */
  protected static final int PRIMER_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getPrimer() <em>Primer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPrimer()
   * @generated
   * @ordered
   */
  protected int primer = PRIMER_EDEFAULT;

  /**
   * The default value of the '{@link #getSegundo() <em>Segundo</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSegundo()
   * @generated
   * @ordered
   */
  protected static final int SEGUNDO_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getSegundo() <em>Segundo</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSegundo()
   * @generated
   * @ordered
   */
  protected int segundo = SEGUNDO_EDEFAULT;

  /**
   * The default value of the '{@link #getTercer() <em>Tercer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTercer()
   * @generated
   * @ordered
   */
  protected static final int TERCER_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getTercer() <em>Tercer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTercer()
   * @generated
   * @ordered
   */
  protected int tercer = TERCER_EDEFAULT;

  /**
   * The default value of the '{@link #getCuarto() <em>Cuarto</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCuarto()
   * @generated
   * @ordered
   */
  protected static final int CUARTO_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getCuarto() <em>Cuarto</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCuarto()
   * @generated
   * @ordered
   */
  protected int cuarto = CUARTO_EDEFAULT;

  /**
   * The cached value of the '{@link #getPuerto() <em>Puerto</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPuerto()
   * @generated
   * @ordered
   */
  protected Puerto puerto;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected IPImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.IP;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getPrimer()
  {
    return primer;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPrimer(int newPrimer)
  {
    int oldPrimer = primer;
    primer = newPrimer;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__PRIMER, oldPrimer, primer));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getSegundo()
  {
    return segundo;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSegundo(int newSegundo)
  {
    int oldSegundo = segundo;
    segundo = newSegundo;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__SEGUNDO, oldSegundo, segundo));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getTercer()
  {
    return tercer;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTercer(int newTercer)
  {
    int oldTercer = tercer;
    tercer = newTercer;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__TERCER, oldTercer, tercer));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getCuarto()
  {
    return cuarto;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setCuarto(int newCuarto)
  {
    int oldCuarto = cuarto;
    cuarto = newCuarto;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__CUARTO, oldCuarto, cuarto));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Puerto getPuerto()
  {
    return puerto;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetPuerto(Puerto newPuerto, NotificationChain msgs)
  {
    Puerto oldPuerto = puerto;
    puerto = newPuerto;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__PUERTO, oldPuerto, newPuerto);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPuerto(Puerto newPuerto)
  {
    if (newPuerto != puerto)
    {
      NotificationChain msgs = null;
      if (puerto != null)
        msgs = ((InternalEObject)puerto).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP__PUERTO, null, msgs);
      if (newPuerto != null)
        msgs = ((InternalEObject)newPuerto).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP__PUERTO, null, msgs);
      msgs = basicSetPuerto(newPuerto, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP__PUERTO, newPuerto, newPuerto));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.IP__PUERTO:
        return basicSetPuerto(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.IP__PRIMER:
        return getPrimer();
      case MyDslPackage.IP__SEGUNDO:
        return getSegundo();
      case MyDslPackage.IP__TERCER:
        return getTercer();
      case MyDslPackage.IP__CUARTO:
        return getCuarto();
      case MyDslPackage.IP__PUERTO:
        return getPuerto();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.IP__PRIMER:
        setPrimer((Integer)newValue);
        return;
      case MyDslPackage.IP__SEGUNDO:
        setSegundo((Integer)newValue);
        return;
      case MyDslPackage.IP__TERCER:
        setTercer((Integer)newValue);
        return;
      case MyDslPackage.IP__CUARTO:
        setCuarto((Integer)newValue);
        return;
      case MyDslPackage.IP__PUERTO:
        setPuerto((Puerto)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.IP__PRIMER:
        setPrimer(PRIMER_EDEFAULT);
        return;
      case MyDslPackage.IP__SEGUNDO:
        setSegundo(SEGUNDO_EDEFAULT);
        return;
      case MyDslPackage.IP__TERCER:
        setTercer(TERCER_EDEFAULT);
        return;
      case MyDslPackage.IP__CUARTO:
        setCuarto(CUARTO_EDEFAULT);
        return;
      case MyDslPackage.IP__PUERTO:
        setPuerto((Puerto)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.IP__PRIMER:
        return primer != PRIMER_EDEFAULT;
      case MyDslPackage.IP__SEGUNDO:
        return segundo != SEGUNDO_EDEFAULT;
      case MyDslPackage.IP__TERCER:
        return tercer != TERCER_EDEFAULT;
      case MyDslPackage.IP__CUARTO:
        return cuarto != CUARTO_EDEFAULT;
      case MyDslPackage.IP__PUERTO:
        return puerto != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (primer: ");
    result.append(primer);
    result.append(", segundo: ");
    result.append(segundo);
    result.append(", tercer: ");
    result.append(tercer);
    result.append(", cuarto: ");
    result.append(cuarto);
    result.append(')');
    return result.toString();
  }

} //IPImpl
